<!DOCTYPE html>
<html lang="ch">
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<iframe id="test-iframe" width="100%" height="100%"></iframe>
	</body>
</html>
<script src="https://cdn.bootcss.com/crypto-js/3.1.9-1/crypto-js.min.js"></script> 
<script>
	  const iframe = document.querySelector('#test-iframe');
	  function getUnionLoginParams() {
		const nonce = 'fb4706';
		const opfid = '00484465407032715328';//开发者中心获取
		const uid = '13064133800';
		const secret = '7df61f8a67de43dcad6a4d071014f650';//开发者中心获取
		const timestamp = Date.now().toString();
		const params = { opfid, secret, uid, nonce, timestamp };
		const query = Object.keys(params)
		  .sort(
			(key1, key2) => key1.charCodeAt(0) - key2.charCodeAt(0)
		  )
		  .reduce((str, key) => (str += `${key}=${params[key]}&`), '')
		  .slice(0, -1);
		const signature = CryptoJS.SHA1(query).toString(CryptoJS.enc.Hex);
		return { nonce, opfid, uid, timestamp, signature };
	  }
 
	  const params = getUnionLoginParams();
	  let loginUrl = 'https://open.rabbitpre.com/union-login.html';
	  loginUrl += `?nonce=${params.nonce}`;
	  loginUrl += `&opfid=${params.opfid}`;
	  loginUrl += `&uid=${params.uid}`;
	  loginUrl += `&timestamp=${params.timestamp}`;
	  loginUrl += `&signature=${params.signature}`;
	  loginUrl += `&redirecturl=${encodeURIComponent('https://dataapi.tuzhanai.com/opendata/basicinfo/')}`;
	  iframe.setAttribute('src', loginUrl);
	   
	</script>

